package Listejer;

import java.awt.Dimension;

import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JFrame;

public class ContainerListener
  extends JFrame
{
  private double largeur=0;
  private double hauteur=0;
  public ContainerListener()
  {
    try
    {
      jbInit();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

  private void jbInit()
    throws Exception
  {
    this.getContentPane().setLayout( null );
    this.setSize( new Dimension(400, 300) );
    largeur=300;
    hauteur=400;
   
    
  }
  private class EcouteurDeFenetre implements ComponentListener
  {


    public void componentResized(ComponentEvent e)
    {
      if(largeur <  ContainerListener.this.getSize().getWidth())
        ContainerListener.this.setTitle("Plus grand");
      else
        ContainerListener.this.setTitle("Plus petit");
      
      largeur = ContainerListener.this.getSize().getWidth();
    }

    public void componentMoved(ComponentEvent e)
    {
    }

    public void componentShown(ComponentEvent e)
    {
    }

    public void componentHidden(ComponentEvent e)
    {
    }
  }
}
